<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'outbox.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	
	<link rel="stylesheet" type="text/css" href="css/box.css">
	

	
	<script type="text/javascript">
		function mychange(){
			var quan=document.getElementById("all");
			var ck=document.getElementsByName("ck");
			for(var i=0;i<ck.length;i++){
				ck[	i].checked=quan.checked;
			}
		}
		function ch(){
			var quan=document.getElementById("all");
			var ck=document.getElementsByName("ck");
			var flag=false;
			for(var i=0;i<ck.length;i++){
				if(ck[i].checked==false){
					quan.checked=false;
					flag=true;
					break;
				}
				if(flag==false)
					quan.checked=true;
			}
		}
		
		
		function showMessageAll(messageid){
		//显示消息详情
		window.showModalDialog("hzx/getmessage?type=showall&m.messageid="+messageid,"",'dialogHeight:570px;dialogWidth:500px;dialogLeft:450px;dialogTop:150px;center:yes;middle:yes;help:no;resizable:no;location:no;status:no;scroll:no');
		}
	
	
	</script>

  </head>
  
  <body>
    <p>>>当前位置:草稿箱</p><br/>
    <center>
    <c:choose>
	    <c:when test="${!empty p.list}">
    	<form action="hzx/messageactiondeletesome?type=draftbox" method="post">
    		<input type="checkbox" name="all"  id="all" onclick="mychange()" />全选
    		<table border="1">
    			<tr>
    				<th>删除（√）</th>
    				<th>收件人</th>
    				<th>主题</th>
    				<th>发送时间</th>
    				<th>紧急程度</th>
    			</tr>
    			<c:forEach items="${p.list}" var="m">
    			<c:if test="${m.userinfo.userid==userinfo.userid && m.ifpublish==0}">
    				<tr onmousemove="this.style.background='#0FF'" onmouseout="this.style.background=''">    				
    					<td style="text-align:center">
    						<input type="checkbox"  name="ck" onclick="ch()" value="${m.messageid}" />
    					</td>
    					<td onclick="javascript:showMessageAll('${m.messageid}')">
    					&nbsp;
    					<a href="javascript:showMessageTouser('${m.messageid}')">
    						<c:forEach items="${messagetouserList}" var="mtu">
				    				<c:if test="${m.messageid==mtu.message.messageid}">	
					    				${mtu.userinfo.username}	
				    				</c:if>
		    				</c:forEach>
		    			</a>
    					</td>
    					<td onclick="javascript:showMessageAll('${m.messageid}')">${m.title}</td>
    					<td onclick="javascript:showMessageAll('${m.messageid}')">${m.recordtime}</td>
    					<td onclick="javascript:showMessageAll('${m.messageid}')"
    						<c:if test="${m.messagetype.messagetypeid==1}">style="color:red"</c:if>
    					>***${m.messagetype.messagetypename}***</td>    				
    				</tr>
    			</c:if>
    			</c:forEach>
    		</table>
    		当前<s:property value="%{#session.p.currentPage}" />页&nbsp;&nbsp;&nbsp;&nbsp;
    		总共<s:property value="%{#session.p.totalPage}" />页&nbsp;&nbsp;&nbsp;&nbsp;
    		<s:a  href="hzx/haction?type=3&page=1">首页</s:a>&nbsp;&nbsp;&nbsp;&nbsp;
    		<s:a  href="hzx/haction?type=3&page=%{#session.p.currentPage-1}">上一页</s:a>&nbsp;&nbsp;&nbsp;
    		<s:a  href="hzx/haction?type=3&page=%{#session.p.currentPage+1}">下一页</s:a>&nbsp;&nbsp;&nbsp;
    		<s:a  href="hzx/haction?type=3&page=%{#session.p.totalPage}">末页</s:a>&nbsp;&nbsp;&nbsp;<br/><br/>
    		<input type="submit" value="删除选定项" />&nbsp;&nbsp;&nbsp;
    		<input type="button" onclick="javascript:history.go(-1)" value="返回" />
    	</form> 
     </c:when>
	 <c:otherwise>
	  <div id="nolist">没有查找到记录</div>
	 </c:otherwise>
	 </c:choose>
    </center>
    
  </body>
</html>
